package com.cx.common.mybatisplus.wrapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.cx.common.mybatisplus.entity.BaseEntity;

public class BaseWrapper<T extends BaseEntity> {

    private final static String FOR_UPDATE = "for update";


    /**
     * 有锁查询操作
     *
     * @return
     */
    public LambdaQueryWrapper<T> lockQueryWrapper() {
        return new LambdaQueryWrapper<T>().last(FOR_UPDATE);
    }

    /**
     * 无锁查询操作
     *
     * @return
     */
    public LambdaQueryWrapper<T> queryWrapper() {
        return new LambdaQueryWrapper<T>();
    }


    /**
     * 更新操作
     *
     * @return
     */
    public LambdaUpdateWrapper<T> updateWrapper() {
        return new LambdaUpdateWrapper<T>();
    }


}
